//
//  PGStatusCellBottomView.swift
//  PGWeibo
//
//  Created by Apple on 15/11/9.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

class PGStatusCellBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor(white: 0.98, alpha: 1)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
// MARK: - 懒加载控件
    private lazy var retweetedButton = UIButton(iconImage: "timeline_icon_retweet", title: " 转发", textSize: 12)
    private lazy var commentdButton = UIButton(iconImage: "timeline_icon_comment", title: " 评论", textSize: 12)
    private lazy var likedButton = UIButton(iconImage: "timeline_icon_unlike", title: " 赞", textSize: 12)
    //两条分割线的视图

}
// MARK: - 设置界面
extension PGStatusCellBottomView {
    private func setupUI() {

        
        //添加控件
        addSubview(retweetedButton)
        addSubview(commentdButton)
        addSubview(likedButton)
        
        
        
        //设置约束
        retweetedButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.right.equalTo(commentdButton.snp_left)
        }
        
        commentdButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.right.equalTo(likedButton.snp_left)
            make.width.equalTo(retweetedButton.snp_width)
        }
        likedButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(retweetedButton.snp_width)
        }
        // 分割线
        let leftSepView = sepView()
        let rightSepView = sepView()
        addSubview(leftSepView)
        addSubview(rightSepView)
        
        let w = 1
        let scale = 0.4
        leftSepView.snp_makeConstraints { (make) -> Void in
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
            make.left.equalTo(retweetedButton.snp_right)
            make.centerY.equalTo(self.snp_centerY)
        }
        rightSepView.snp_makeConstraints { (make) -> Void in
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
            make.left.equalTo(commentdButton.snp_right)
            make.centerY.equalTo(self.snp_centerY)
        }
    }

    
    private func sepView() -> UIView {
        let sep = UIView()
        sep.backgroundColor = UIColor.lightGrayColor()
        return sep
    }
}
